package com.ccc.scala.base1

import java.io.{OutputStreamWriter, PrintWriter}
import java.net.Socket

object Base5_Network2 {
  // 网络
  def main(args: Array[String]): Unit = {
    val client = new Socket("localhost", 9999)
    val out = new PrintWriter(
      new OutputStreamWriter(
        client.getOutputStream, "UTF-8"
      )
    )
    out.print("hello Scala")
    out.flush()
    out.close()
    client.close()
  }
}
